package com.fm.webrtc.websocket.message.transport;

import com.fm.mediasoup.sdp.Candidate;

public class IceCandidates {
    public String foundation;
    public String ip;
    public Integer port;
    public Long priority;
    public String protocol;
    public String type;

    @Override
    public String toString() {
        return "IceCandidates{" +
                "foundation='" + foundation + '\'' +
                ", ip='" + ip + '\'' +
                ", port=" + port +
                ", priority=" + priority +
                ", protocol='" + protocol + '\'' +
                ", type='" + type + '\'' +
                '}';
    }

    /**
     * 转换为 sdp candidate格式
     * @return
     */
    public Candidate conversionSdpCandidate(){
        Candidate candidate = new Candidate();
        candidate.ip = this.ip;
        candidate.port = this.port;
        candidate.foundation = this.foundation;
        candidate.transport = this.protocol;
        candidate.priority = this.priority;
        candidate.type = this.type;
        candidate.component = 1;
        return candidate;
    }
}
